package cn.bdqn.page2;

import java.util.Iterator;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

/**
 * 套餐余额查询
 */
public class TaoCanYuE {
	// 因为所有的方法都需要DOM树
	static Document document = null;
	static Element root = null;

	public void yuE(String phone) throws DocumentException {
		System.out.println("**********套餐余量查询************");
		System.out.println("您的卡号是：" + phone + "\n套餐内剩余：");
		SAXReader reader = new SAXReader();
		document = reader.read("UserMessage.xml");
		root = (Element) document.getRootElement();
		Iterator itUser = root.elementIterator();
		while (itUser.hasNext()) {
			Element user = (Element) itUser.next();
			System.out.println("通话时长：" + user.attributeValue("longCall"));
			System.out.println("短信条数：" + user.attributeValue("shortMessage"));
			System.out
					.println("上网流量：" + user.attributeValue("internetTraffic"));
			break;
		}

	}
}
